import {
	getStorage
} from '@/utils/setStorage.js';
// 页面名单
const whiteList = [
	'/pages/home/index',
	'/pages/maps/index',
	'/pages/me/index',
]

uni.addInterceptor('switchTab', {
	// tabbar页面跳转前进行拦截
	invoke(e) {
		if (e.url === whiteList[0]) {
			console.log('haohao')
			return true
		} else {
			const token = getStorage('token')
			if (token === undefined || token === null || token === '') {
				uni.$emit('login', true);
				return true
			} else {
				console.log('1')
				return true
			}
		}
		console.log(e)
		// return false
	},
	success(e) {
		// console.log(e)
	}
})
